<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>后台管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="/css/public.css" media="all" />
	<style>
		span.button.root_close::before {
			content: "\e623";
		}
		span.button.root_open::before {
			content: "\e625";
		}
	</style>
</head>
<body class="childrenBody">
<div id="container" style="height: 400px"></div>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts.min.js"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-gl/echarts-gl.min.js"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts-stat/ecStat.min.js"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/dataTool.min.js"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/china.js"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/map/js/world.js"></script>
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=ZUONbpqGBsYGXNIYHicvbAbM"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/bmap.min.js"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/simplex.js"></script>
<script type="text/javascript" src="/layui/layui.js"></script>
<script src="/js/common/jquery-3.3.1.js"></script>
<script src="/js/common/jquery.cookie.js"></script>
<script src="/layui/mymodule/common.js"></script>
<script type="text/javascript" src="/js/agriecom_quotation/quotationEdit.js"></script>
</body>
<script type="text/javascript">
	layui.use(['form','tree','element','table','laytpl','treeGrid','layer','jquery'],function(){
		var dom = document.getElementById("container");
		var myChart = echarts.init(dom);
		var app = {};
		var option = {
			xAxis: {
				type: 'category',
				data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
			},
			yAxis: {
				type: 'value'
			},
			series: [{
				data: [820, 932, 901, 934, 1290, 1330, 1320],
				type: 'line'
			}]
		};

		if (option && typeof option === "object") {
			myChart.setOption(option, true);
		}
		myChart.setOption({
			title: {
				text: '商品最近七次价格变动'
			},
			xAxis: {
				type: 'category',
				data: ['一', '二', '三', '四', '五', '六', '七']
			},
			yAxis: {
				type: 'value'
			},
			series: [{
				data: [],
				type: 'line'
			}],

			/*tooltip: {},
            legend: {
                data:['销量']
            },
            xAxis: {
                data: []
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: []
            }]*/
		});
		function GetRequest() {
			var url = location.search;         //获取url中"?"符后的字串
			var theRequest = new Object();
			if (url.indexOf("?") != -1) {
				var str = url.substr(1);
				var strs = str.split("&");
				for (var i = 0; i < strs.length; i++) {
					theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
				}
			}
			return theRequest;
		}
		var request = GetRequest();
		// 异步加载数据
		$.get('/quotation/trend?id='+request.id).done(function (data) {

			// 填入数据

			console.log(data);
			myChart.setOption({
				/*xAxis: {
                    data: data.categories
                },*/
				series: [{
					// 根据名字对应到相应的系列
					type: 'line',
					data: data
				}]
			});
		});
	});

</script>
</html>